package com.isoft.service.tableservice;

import com.isoft.dao.tabledao.DfmeFrttDao;
import com.isoft.entity.tableentity.dfme_frtt.DfmeFrttMsg;
import com.isoft.utils.TimeFormatUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.text.ParseException;

@Service
@Slf4j
public class DfmeFrttService {
    @Autowired
    DfmeFrttDao dfmeFrttDao;
    public int insertmsg(DfmeFrttMsg dfmeFrttMsg) throws ParseException {
        Timestamp create_time = new Timestamp(System.currentTimeMillis());
        Timestamp frtt= TimeFormatUtils.stringToTimestamp(dfmeFrttMsg.getDfmeFrttDflt().getFrtt());
        Timestamp frlt= TimeFormatUtils.stringToTimestamp(dfmeFrttMsg.getDfmeFrttDflt().getFrlt());
        dfmeFrttDao.insertMeta(create_time,dfmeFrttMsg.getDfmeFrttMeta());
        return  dfmeFrttDao.insertDflt(dfmeFrttMsg.getDfmeFrttMeta().getSeqn(),create_time,frtt,frlt,dfmeFrttMsg.getDfmeFrttDflt());

    }
}
